import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login/login.vue')
  },
  {
    path: '/',
    name: 'layout',
    component: () => import('../views/Layout/index.vue'),
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/Home/home.vue')
      },
      {
        path: '/goods',
        name: 'goods',
        component: () => import('../views/Goods/index.vue')
      },
      {
        path: '/order',
        name: 'order',
        component: () => import('../views/Order/order.vue')
      },
      {
        path: '/notice',
        name: 'notice',
        component: () => import('../views/Notice/index.vue')
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/User/index.vue')
      },
      {
        path: '/contract',
        name: 'contract',
        component: () => import('../views/Contract/index.vue')
      },
      {
        path: '/carousel',
        name: 'carousel',
        component: () => import('../views/Carousel/index.vue')
      },
      {
        path: '/invoice',
        name: 'invoice',
        component: () => import('../views/Tool/invoice.vue')
      },
      {
        path: '/table',
        name: 'table',
        component: () => import('../views/Tool/table.vue')
      }
    ]
  },
  {
    path: '/header',
    name: 'header',
    component: () => import('../views/Header/index.vue')
  },
  {
    path: '/',
    name: 'receptionHome',
    redirect: '/main',
    component: () => import('../views/Reception/home.vue'),
    children: [
      {
        path: '/main',
        name: 'main',
        component: () => import('../views/Reception/main.vue')
      },
      {
        path: '/more',
        name: 'more',
        component: () => import('../views/Reception/more.vue')
      },
      {
        path: '/discount',
        name: 'discount',
        component: () => import('../views/Reception/discount.vue')
      },
      {
        path: '/backState',
        name: 'backState',
        component: () => import('../views/Reception/backState.vue')
      },
      {
        path: '/shopCard',
        name: 'shopCard',
        component: () => import('../views/Reception/shopCard.vue')
      },
      {
        path: '/person',
        name: 'person',
        component: () => import('../views/Reception/person.vue')
      }
    ]
  },
  {
    path: '/login-register',
    name: 'login-register',
    component: () => import('../views/Reception/loginRegister.vue')
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import('../views/Reception/detail.vue')
  },
  {
    path: '/res',
    name: 'res',
    component: () => import('../views/Reception/res.vue')
  }
]

const router = new VueRouter({
  // mode: 'history',
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
